﻿<UserControl x:Class="SellAvi.Views.ControlAuthenticate"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
             xmlns:command="http://www.galasoft.ch/mvvmlight"
             xmlns:classes="clr-namespace:SellAvi.Classes"
             mc:Ignorable="d"
             DataContext="{Binding Main, Source={StaticResource Locator}}"
             >
    <!--d:DesignHeight="300" d:DesignWidth="300"-->
    <Grid Margin="10,0,10,10" Width="160">
        <Grid.RowDefinitions>
            <RowDefinition Height="18" />
            <RowDefinition Height="18" />
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="42" />
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="18" />
        </Grid.ColumnDefinitions>
        <TextBlock Grid.Row="0" Grid.Column="0">Логин</TextBlock>
        <TextBox Grid.Row="0" Grid.Column="1" Padding="-2,0,5,0" Text="{Binding CurrentUser.UserName,UpdateSourceTrigger=PropertyChanged}">
            <i:Interaction.Triggers>
                <i:EventTrigger EventName="TextChanged">
                    <command:EventToCommand Command="{Binding CredentialsChangedCommand}" />
                </i:EventTrigger>
            </i:Interaction.Triggers>
        </TextBox>
        <Button Grid.Row="0" Grid.Column="2" Background="WhiteSmoke" Command="{Binding CallUserListCommand}" ToolTip="Управление пользователями">
            <Image Source="/SellAvi;component/Resources/user.png"></Image>
        </Button>
        <TextBlock Grid.Row="1" Grid.Column="0">Пароль</TextBlock>
        <!--<TextBox Grid.Row="1" Padding="-2,0,5,0" Grid.Column="1" Text="{Binding CurrentUser.UserPassword,UpdateSourceTrigger=PropertyChanged}">
            <i:Interaction.Triggers>
                <i:EventTrigger EventName="TextChanged">
                    <command:EventToCommand Command="{Binding CredentialsChangedCommand}" />
                </i:EventTrigger>
            </i:Interaction.Triggers>
        </TextBox>-->
        <PasswordBox Name="PasswordBox" Grid.Row="1" Padding="-2,0,5,0" Grid.Column="1" classes:PasswordBoxAssistant.BindPassword="true"  classes:PasswordBoxAssistant.BoundPassword="{Binding Path=CurrentUser.UserPassword, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" FontSize="10">
            <i:Interaction.Triggers>
                <i:EventTrigger EventName="PasswordChanged">
                    <command:EventToCommand Command="{Binding CredentialsChangedCommand}"/>
                </i:EventTrigger>
            </i:Interaction.Triggers>
        </PasswordBox>

        <Button Grid.Row="1" Grid.Column="2" Background="WhiteSmoke" Command="{Binding AuthenticateCommand}" ToolTip="Авторизоваться на сайте" IsDefault="True" >
            <Image Source="/SellAvi;component/Resources/forward.png"></Image>
        </Button>
    </Grid>
</UserControl>
